<?php 

namespace Home\Dto;

class BaseDto
{

    public $attribute = [];
    public $id;

    public function __construct($param) {
        $this->attribute = array_merge($this->attribute, $param);
    }

    public function toArray(){
        return $this->attribute;
    }
    public function toJson() {
        return json_encode($this->attribute);
    }

    final public function __get($key)
    {
        return $this->attribute[$key];
    }

    final public function __set($key, $val){
        $this->attribute[$key] = $val;
    }

}